package cn.wen233.srpc.core.holder;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 服务端 Service实例持有器
 *
 * @author wenei
 * @date 2021-12-26 11:29
 */
public class ServerServiceHolder {

    private static final Map<String, Object> serviceInstanceMap = new ConcurrentHashMap<>();

    public static void putServiceInstance(String serviceName, Object instance) {
        serviceInstanceMap.put(serviceName, instance);
    }

    public static Object getService(String serviceName) {
        return serviceInstanceMap.get(serviceName);
    }
}
